#!/usr/bin/python
# Copyright 2011, Kitware, Inc.

import sys

if len(sys.argv) == 2:
    filename = sys.argv[1]
else:
    filename = '/home/tutorial/Tutorial/Data/cthead1.png'

import SimpleITK as sitk

image = sitk.ReadImage(filename)
sitk.Show(image, 'Slice')
image = sitk.Cast(image, sitk.sitkFloat32)
thresh = sitk.OtsuThreshold(image, 0, 230, 15)
sitk.Show(thresh, 'Thresholded')
